define(['zepto'],function() {
	var xing = $('.xing');
	var orangered = $('.orangered');
	var hao = $('#hao');
	var zhong = $('#zhong');
	var cha = $('#cha');
	var bgcolor = document.getElementsByClassName('bgcolor');
	var zhi = document.getElementsByClassName('zhi');
	var a = [],
		b = [],
		c = [];
	var aa = 0,
		bb = 0,
		cc = 0;
	xing.each(function(i, v) {
		if($(xing[i]).children('.orangered').length >= 4) {
			a[aa] = $(xing[i]).children('.orangered').length;
			aa += 1;
		} else if($(xing[i]).children('.orangered').length >= 2 && $(xing[i]).children('.orangered').length < 4) {
			b[bb] = $(xing[i]).children('.orangered').length;
			bb += 1;
		} else {
			c[cc] = $(xing[i]).children('.orangered').length;
			cc += 1;
		}
	})
	//批量计算评论比率
	var z,h;
	z=[a,b,c];
	h=[hao,zhong,cha];
	/*
	 * n 为好中差各自评论数 组成的数组
	 * m 为好中差定义的变量组成的数组
	 */
	function d(n, m) {
		var num = 0;
		for(var j = 0; j < n.length; j++) {
			num += n[j].length;
		}
		for(var i = 0; i < n.length; i++) {
			bgcolor[i].style.width = n[i].length / num * 100 + "%";
			zhi[i].innerText = (n[i].length / num * 100).toFixed(2) + "%";
			m[i].text(n[i].length);
		}

	}
	d(z,h);
//	z = a.length + b.length + c.length;
	//	bgcolor[0].style.width = a.length / z * 100 + "%";
	//	zhi[0].innerText = (a.length / z * 100).toFixed(2) + "%";
	//	bgcolor[1].style.width = b.length / z * 100 + "%";
	//	zhi[1].innerText = (b.length / z * 100).toFixed(2) + "%";
	//	bgcolor[2].style.width = c.length / z * 100 + "%";
	//	zhi[2].innerText = (c.length / z * 100).toFixed(2) + "%";
	//	hao.text(a.length);
	//	zhong.text(b.length);
	//	cha.text(c.length);
})